<?
    /* -*- Mode: PHP5; tab-width: 4; indent-tabs-mode: nil; basic-offset: 4 -*- */

    /*********************************************************
    *            --== InArch ==--
    *
    * @author Kulikov Alexey <a.kulikov@gmail.com>
    * @version n/a
    * @since 23.04.2005
    * @copyright essentialmind.com 2005
    *
    *********************************************************/
    
    /***
    * Class adminLogout
    ****
    * This will terminate the current admin session
    ****
    * @package adminModules
    * @author A Kulikov <a.kulikov@gmail.com>
    * @version n/a
    * @since 23.04.2005
    * @copyright essentialmind.com 2005
    ***/
    class adminLogout extends adminModule{

        /**
         * adminLogout::process()
         * 
         * Process inputs
         * 
         * @return void 
         **/
        public function process(){
            //make a note of the 404 request
            $this->log->recordAction("User logged out");

            //close session
            session_destroy();

            //destroy login cookie (if any)
            if(isset($_COOKIE['ina_autologin'])){
                setcookie('ina_autologin',false,time(),'/');
            }

            //redirect to root
            header("Location: ".$GLOBALS['_CONFIG']['admin_root']);
            exit;
        }

        /**
         * adminLogout::setTemplate()
         * 
         * set the action template to login.html
         * in fact, as the process() method creates a
         * redirect, then we do not need an action template
         * yet this is a requirement of the abstract class
         * thus we give it a reference to the login
         * template.
         * 
         * @return void
         **/
        public function setTemplate(){
            $this->setActionTemplate('login.html');
        }
    }
?>